﻿<UserControl x:Class="AddinInfo"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Metro="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
             xmlns:my="clr-namespace:Biller"
             mc:Ignorable="d" 
             d:DesignHeight="600" d:DesignWidth="900" DataContextChanged="UserControl_DataContextChanged_1">
    <UserControl.Resources>
        <ResourceDictionary>
            <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
            <my:InverseBooleanConverter x:Key="InverseBooleanConverter"/>
            <my:ValueConverterGroup x:Key="InvertAndVisibilitate">
                <my:InverseBooleanConverter/>
                <BooleanToVisibilityConverter/>
            </my:ValueConverterGroup>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="de.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colours.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.AnimatedSingleRowTabControl.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
                <ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid>
        <StackPanel Visibility="Collapsed" Name="sp_AddinInfo">
            <TextBlock Text="{Binding Name, FallbackValue=Addin-Name, Mode=OneWay}" FontSize="{StaticResource HeaderFontSize}" FontFamily="{StaticResource HeaderFontFamily}" HorizontalAlignment="Left" Margin="6,0,0,0" VerticalAlignment="Top" />
            <TextBlock FontSize="{StaticResource NormalFontSize}" FontFamily="{StaticResource ContentFontFamily}" HorizontalAlignment="Left" Margin="12,0,0,0" VerticalAlignment="Top">
            By 
            <Run Text="{Binding Author, FallbackValue=Autor, Mode=OneWay}"/>
            </TextBlock>
            <TextBlock FontSize="{StaticResource NormalFontSize}" FontFamily="{StaticResource ContentFontFamily}" HorizontalAlignment="Left" Margin="12,0,0,0" VerticalAlignment="Top">
            Version 
            <Run Text="{Binding Version, FallbackValue=1.0, Mode=OneWay}"/>
            </TextBlock>

            <TextBlock Text="{StaticResource Status}" FontSize="{StaticResource SubHeaderFontSize}" FontFamily="{StaticResource HeaderFontFamily}" HorizontalAlignment="Left" Margin="6,12,0,0" VerticalAlignment="Top"/>
            <TextBlock Text="{StaticResource Activated}" FontSize="{StaticResource NormalFontSize}" FontFamily="{StaticResource ContentFontFamily}" HorizontalAlignment="Left" Margin="12,0,0,0" VerticalAlignment="Top" Visibility="{Binding IsEnabled, Converter={StaticResource BooleanToVisibilityConverter}}"/>
            <TextBlock Text="{StaticResource Deactivated}" FontSize="{StaticResource NormalFontSize}" FontFamily="{StaticResource ContentFontFamily}" HorizontalAlignment="Left" Margin="12,0,0,0" VerticalAlignment="Top" Visibility="{Binding IsEnabled, Converter={StaticResource InvertAndVisibilitate}}"/>

            <TextBlock Text="{StaticResource Rights}" FontSize="{StaticResource SubHeaderFontSize}" FontFamily="{StaticResource HeaderFontFamily}" HorizontalAlignment="Left" Margin="6,12,0,0" VerticalAlignment="Top"/>
            <GroupBox Margin="12,6,15,0" IsEnabled="False" FontSize="12" Header="{DynamicResource WriteAccess}">
                <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
                    <CheckBox Content="{StaticResource Order}" FontSize="12" IsChecked="{Binding UserRequest.CanWriteOrder, Mode=OneWay}"/>
                    <CheckBox Content="{StaticResource Article}" FontSize="12" Margin="20,0,0,0" IsChecked="{Binding UserRequest.CanWriteArticle, Mode=OneWay}"/>
                    <CheckBox Content="{StaticResource Customer}" FontSize="12" Margin="20,0,0,0" IsChecked="{Binding UserRequest.CanWriteCustomer, Mode=OneWay}"/>
                </StackPanel>
            </GroupBox>
            <GroupBox Margin="12,6,15,0" IsEnabled="False" FontSize="12" Header="{StaticResource ReadAccess}">
                <StackPanel Orientation="Horizontal" Margin="0,0,0,5">
                    <CheckBox Content="{StaticResource Order}" FontSize="12" IsChecked="{Binding UserRequest.CanReadOrder, Mode=OneWay}"/>
                    <CheckBox Content="{StaticResource Article}" FontSize="12" Margin="20,0,0,0" IsChecked="{Binding UserRequest.CanReadArticle, Mode=OneWay}"/>
                    <CheckBox Content="{StaticResource Customer}" FontSize="12" Margin="20,0,0,0" IsChecked="{Binding UserRequest.CanReadCustomer, Mode=OneWay}"/>
                </StackPanel>
            </GroupBox>
            <Button Content="{StaticResource GrantRights}" Width="200" HorizontalAlignment="Left" Margin="12,6,0,0" Click="Button_Click_3" Visibility="Collapsed"/>
            <Button Content="{StaticResource DenyRights}" Width="200" HorizontalAlignment="Left" Margin="12,6,0,0" Click="Button_Click_4" Visibility="Collapsed"/>

            <TextBlock Text="{StaticResource Actions}" FontSize="{StaticResource SubHeaderFontSize}" FontFamily="{StaticResource HeaderFontFamily}" HorizontalAlignment="Left" Margin="6,12,0,0" VerticalAlignment="Top"/>
            <Button Content="{StaticResource Deactivate}" Width="200" HorizontalAlignment="Left" Margin="12,6,0,0" Visibility="{Binding IsEnabled, Converter={StaticResource BooleanToVisibilityConverter}}" Click="Button_Click_1"/>
            <Button Content="{StaticResource Activate}" Width="200" HorizontalAlignment="Left" Margin="12,6,0,0" Visibility="{Binding IsEnabled, Converter={StaticResource InvertAndVisibilitate}}" Click="Button_Click_2"/>
        </StackPanel>
        <StackPanel Name="sp_noAddin">
            <TextBlock Text="{StaticResource ChooseAddin}" FontSize="{StaticResource HeaderFontSize}" FontFamily="{StaticResource HeaderFontFamily}" HorizontalAlignment="Left" Margin="6,0,0,0" VerticalAlignment="Top" />
        </StackPanel>
    </Grid>
    
</UserControl>
